import request from '@/utils/request'

export function getSubjectList(sid) {
  return request({
    url: '/p/pms/subject/cate/' + sid,
    method: 'get',
  })
}

export function addBook(data) {
  return request({
    url: '/pms/book/create',
    method: 'post',
    data: data,
    contentType: "multipart/form-data",
    processData: false
  })
}

export function deleteFile(id) {
  return request({
    url: '/pms/book/file/delete/' + id,
    method: 'get',
  })
}

export function getFileByBid(id) {
  return request({
    url: '/pms/book/fileByBid/' + id,
    method: 'get',
  })
}

export function updateFileRelationSort(id, sort) {
  return request({
    url: '/pms/book/file/update/sort/' + id,
    method: 'get',
    params: {
      sort
    }
  })
}

export function getBook(id) {
  return request({
    url: '/pms/book/' + id,
    method: 'get'
  })
}

export function deleteBook(id) {
  return request({
    url: '/pms/book/delete/' + id,
    method: 'get'
  })
}
